// pages/confirmOrder/confirmOrder.js
var app=getApp()
Page({
  data:{},
  //提交订单
  formsubmit:function(e){
    var url=app.data.url
    var formData=e.detail.value
    console.log(formData)
    wx.request({
      url: '' + url + '/shop/order/save',
      data: formData,
      header: {
        'Content-Type': 'application/json'
      },
      success: function (res) {
        if (res.status=='ok'){
          wx.navigateTo({
            url: '',
          })
        }else{
          return
        }
      },
      error: function (res) {
        console.log(res)
      }
    })
  },
  onLoad:function(options){
    var that=this
    var url=app.data.url
    var data=options.data
    console.log(data)
    //收货地址列表
    wx.request({
      url: '' + url +'/shop/order/getgoods',
      data: { wid: '', data: data },
      header: {
        'Content-Type': 'application/json'
      },
      success: function (res) {
        console.log(res)
        var orderDetail=res.data.Rows
        var orderelse=res.data
        that.setData({
          orderDetail: orderDetail,
          orderelse: orderelse,
          url:url,
          data: data
        })
      },
      error: function (res) {
        console.log(res)
      }
    })
  },
  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    // 页面显示
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  }
})